<%-- 
    Document   : UserProfileView
    Created on : Apr 2, 2014, 4:38:39 AM
    Author     : asmaa
--%>

<%@include file="headerAdmin.jsp" %>


<sql:query dataSource="${conn}" var="result">
    SELECT * from User where id=?;
    <sql:param value="${param.id}" />
</sql:query>
<sql:query dataSource="${conn}" var="cart">
    SELECT Product.price,Product.name,Cart.* from Cart,Product,User where Cart.productId=Product.id and status =1 and userId= User.id and User.id=?;
    <sql:param value="${param.id}" />
</sql:query>
<div class="top_bg">
    <div class="wrap">
        <div class="main_top">
            <h2 class="style">All Users</h2>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="col-md-6" >
            <div class="panel panel-default">
                <div class="panel-body">
                    <c:forEach var="row" items="${result.rows}">
                        <div class="form-group">
                            <label for="name">Name</label><br>
                            <input type="text" name="name" disabled required value="${row.name}">
                        </div>
                        <div class="form-group">
                            <label for="job">Job</label><br>
                            <input name="job" disabled required value="${row.job}">
                        </div>
                        <div class="form-group">
                            <label for="address">Address</label><br>
                            <input type="text" required disabled name="address" value="${row.address}">
                        </div>
                        <div class="form-group">
                            <label for="email">Email</label><br>
                            <input type="text" required disabled name="email" value="${row.email}">
                        </div>
                        <div class="form-group">
                            <label for="interest">interest</label><br>
                            <input type="text" required disabled name="interest" value="${row.interest}">
                        </div>
                        <div class="form-group">
                            <label for="birthday">Birthday</label><br>
                            <input type="text" required disabled name="birthday" value="${row.birthday}">
                        </div>
                        <div class="form-group">
                            <label for="creditLimit">Credit Limit</label><br>
                            <input type="text" required disabled name="creditLimit" value="${row.creditLimit}">
                        </div>
                        <div class="form-group"> 
                            <button type="button" onclick="EditUser(${row.id})" class="btn btn-sm btn-success">Edit</button>
                        </div>
                    </div>
                </c:forEach>

                </form>
            </div>
        </div>
        <div class="col-md-6" >
            <div class="panel panel-default">
                <div class="panel-body">
                    <h2>History</h2>
                    <c:forEach var="row" items="${cart.rows}">
                        
                        <div class="form-group">
                            <label for="name">Product Name:</label><br>
                            <input type="text" name="name" disabled required value="${row.name}">
                        </div>
                        <div class="form-group">
                            <label for="name">Product Price:</label><br>
                            <input type="text" name="name" disabled required value="${row.price}">
                        </div>
                        <div class="form-group">
                            <label for="name">Purchased Quantity:</label><br>
                            <input type="text" name="name" disabled required value="${row.quantity}">
                        </div>
                        <div class="form-group">
                            <label for="history">Time Purchased:</label><br>
                            <input type="text" name="history" disabled required value="${row.history}">
                        </div>
                        <hr>
                    </c:forEach>

                    </form>
                </div>
            </div>

        </div>
    </div>
    <%@ include file="footer.jsp" %>
